
#ifndef _OSAPI_THREAD_H
#define _OSAPI_THREAD_H

// 线程主路径
typedef int (*os_thread_routine_t)(void* context);

// 线程
typedef struct  
{
	void* pPriv;

	// 内部变量
	os_thread_routine_t  _pRoutine;
	void* _pContext;
}os_thread_t;

int os_thread_create(os_thread_t* th, os_thread_routine_t routine, void* context);
void os_thread_destroy(os_thread_t* th);
unsigned long int os_thread_run(os_thread_t* th);
void os_thread_stop(os_thread_t* th);

/////////// global function ////////////
int os_thread_join(os_thread_t* th);
void os_thread_msleep(int ms);
void os_thread_sleep(int s);
unsigned long int os_thread_id();

#endif

